Conversation
… target type Agent-Logs-Url: https://github.com/Tim-Maes/Facet/sessions/b99d33a2-f1df-4f63-8a77-f77eee40a137 Co-authored-by: Tim-Maes <91606949+Tim-Maes@users.noreply.github.com>
…GetSourceSimpleName helper Agent-Logs-Url: https://github.com/Tim-Maes/Facet/sessions/b99d33a2-f1df-4f63-8a77-f77eee40a137 Co-authored-by: Tim-Maes <91606949+Tim-Maes@users.noreply.github.com>
|
@copilot Don't forget to update readme's and docs |
Agent-Logs-Url: https://github.com/Tim-Maes/Facet/sessions/ea85edd6-ba9a-46e7-9154-fcafff87f941 Co-authored-by: Tim-Maes <91606949+Tim-Maes@users.noreply.github.com>
Done in commit 88c8802:
|
|
I tried adding this branch to my solution instead of the .nuget packages, but it does not run the generators on build (no Dtos are generated). Since I'm new to the code generators, I'm probably missing something. |
|
@copilot Update the workflow so that PR's can be published as preview packages to NuGet =) |
Agent-Logs-Url: https://github.com/Tim-Maes/Facet/sessions/5964c559-7279-46da-9d7f-dcb6e595d331 Co-authored-by: Tim-Maes <91606949+Tim-Maes@users.noreply.github.com>
Done in commit 00e46dc — new
|
|
I have taken a quick once over what Copilot has done and some of the parts I could follow looked sensible. (The tests, for example) There are also many parts that I still don't really have enough understanding. |
|
Can you update the PR so it runs the preview generation? |
📦 Preview packages publishedVersion: Install with: This pre-release is published automatically from this PR and will be overwritten on the next push. |
|
Armed with the preview package I can confirm that t works as expected and generates constructors as well as projections and ToSource |
|
Let's ship it. What a time to be alive, didn't even have to open my editor. Thanks ! |
I must say, Copilot is getting quite scary with its competence... 😮 |
[Facet]already hadAllowMultiple = truebut the generator silently ignored every attribute after the first —ModelBuilderalways readcontext.Attributes[0], and even when the pipeline produced duplicate models they were deduplicated away.What changed
Generator pipeline
ModelBuilder: addedBuildModels()that iterates allcontext.Attributes, one model per[Facet];BuildModelnow delegates to a shared privateBuildModelForAttribute.FacetGenerator: switched from.Select(BuildModel)→.SelectMany(BuildModels); groups models by targetFullNamebefore emitting;facetLookupuses first-wins instead ofToDictionary(which would throw on duplicate keys).Code generation for multi-source targets
CodeBuilder.GenerateCombined: emits a single.g.cswith the union of all source members (deduped by name, first-wins), then generates per-source artefacts:FromSourceoverloads — no naming change needed (naturally overloaded by parameter type).ProjectionFrom{SourceSimpleName}static property per source (avoids static-property name collision).To{SourceSimpleName}()instance method per source (can't overload on return type);BackToalias suppressed for multi-source.MemberGenerator.GenerateMembersaccepts an optionalmembersOverridelist for the union-member pass.ProjectionGenerator/ToSourceGeneratoraccept optional name parameters; single-source output is fully backward-compatible (Projection,ToSource(),BackTo()unchanged).Documentation
docs/06_AdvancedScenarios.md: new "Multiple Source Types to One Target" section covering motivation, generated API, union-of-members behaviour, per-sourceGenerateToSource, and a behaviour reference table.docs/README.mdandREADME.md: updated table of contents and features list to reference multi-source mapping.CI — Preview NuGet publishing
.github/workflows/preview.yml: triggers on every PR push (opened,synchronize,reopened) targetingmain/master/develop.{base_version}-preview.pr{PR_NUMBER}.{RUN_NUMBER}(e.g.6.1.4-preview.pr42.7).release.yml.dotnet add packageinstall command.concurrency: cancel-in-progressper PR prevents stale publishes when multiple commits land quickly.Usage